<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>计算器</title>
<script src="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="c" ng-controller="c1">
第一个数：<input type="text" ng-model="n1">
<br>
第二个数：<input type="text" ng-model="n2">
<br>
{{n1}}加{{n2}}={{n3}}
<br>
{{n1}}减{{n2}}={{n1-n2}}
<br>
{{n1}}乘{{n2}}={{n1*n2}}
<br>
{{n1}}除{{n2}}={{n1/n2}}

<script>
var ap=angular.module("c",[]);
ap.controller("c1",function($scope){
	$scope.n1=0;
	$scope.n2=0;
	$scope.$watch("n2",function(newValue,oldValue){
		$scope.n3=parseInt($scope.n1)+parseInt($scope.n2);
	});
	$scope.$watch("n1",function(newValue,oldValue){
		$scope.n3=parseInt($scope.n1)+parseInt($scope.n2);
	});
	
	
});
</script>

</body>
</html>